#!/bin/bash

APP=ODS
hive=/opt/lagou/servers/hive-2.3.7/bin/hive

source /etc/profile

if [ -n "$1" ]
then
  do_date=$1
else
  do_date=`date -d "-1 day" +%F`
fi

sql="
alter table "$APP".ods_start_log add partition(dt='$do_date');
"
$hive -e "$sql"